package test.designmode.masterworker;

/**
 * Created by linshuo on 2018/3/4.
 */
public class PowerWorker extends Worker<PowerArgs> {

    /**
     * 返回 base^index
     *
     * @param arg 底数_指数
     * @return
     */
    @Override
    public Object handle(PowerArgs arg) {
        int result = 1;
        for (int i = 0; i < arg.getIndex(); i++) {
            result *= arg.getBase();
        }
        return result;
    }
}
